//
//  LogInInputPwdVc.m
//  MJApp
//
//  Created by John on 15/5/12.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "LogInInputPwdVc.h"
#import "RegisterFinishViewController.h"

@interface LogInInputPwdVc ()
{

    NSString * _phone;
}
@property (weak, nonatomic) IBOutlet UITextField *nickName;
@property (weak, nonatomic) IBOutlet UITextField *pwdText;
@property (weak, nonatomic) IBOutlet UITextField *repeatPwdText;

@end

@implementation LogInInputPwdVc

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (id)initWithPhone:(NSString *)phone{
    
    if (self = [super init]) {
        _phone = phone;
    }
    return self;
}
- (IBAction)register:(id)sender {
     NSMutableDictionary * param = [NSMutableDictionary dictionary];
    param[@"nickname"] = self.nickName.text;
    param[@"password"] = self.pwdText.text;
    param[@"user_name"] =_phone;
    param[@"type"] = @(0);
    [WLHTTPRequest registerSetInfoWithParam:param usingSucessBlock:^(BOOL isSucess, NSDictionary *resultDictionary) {
        NSLog(@"注册完成:%@",resultDictionary);
        if([[resultDictionary cusObjectForKey:@"status"]intValue]==1){
//            [DMCAlertCenter defaultCenter] po
//            [self.navigationController popToRootViewControllerAnimated:YES];
            [self.navigationController pushViewController:[[RegisterFinishViewController alloc]init] animated:YES];
        }else{
            [[DMCAlertCenter defaultCenter] postAlertWithMessage:[resultDictionary cusObjectForKey:@"msg"]];
        
        }
    } andFailureBlock:^(NSError *resultError) {
        
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
